package com.feeling.oafeeling.controller;

import com.feeling.oafeeling.common.pojo.AjaxResult;
import com.feeling.oafeeling.pojo.CheckApprovalRecord;
import com.feeling.oafeeling.pojo.TaskList;
import com.feeling.oafeeling.service.MyTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Administrator
 */
@RestController
@RequestMapping("/mytask")
public class MyTaskController {

    @Autowired
    private MyTaskService myTaskService;

    @PreAuthorize("@ss.hasPermi('system:post:list')")
    @PostMapping("/list")
    public AjaxResult getTaskList(@RequestBody CheckApprovalRecord approvalRecord){
        List<CheckApprovalRecord> myTaskList = myTaskService.getMyTaskList(approvalRecord);
        return AjaxResult.success("操作成功",myTaskList);
    }

    @PreAuthorize("@ss.hasPermi('system:post:list')")
    @PostMapping("/type")
    public AjaxResult getTaskTypeList(@RequestBody CheckApprovalRecord approvalRecord){
        List<CheckApprovalRecord> myTaskList = myTaskService.getTaskTypeList(approvalRecord);
        return AjaxResult.success("操作成功",myTaskList);
    }

    @PreAuthorize("@ss.hasPermi('system:post:list')")
    @PostMapping("/step")
    public AjaxResult getTaskStepList(@RequestBody CheckApprovalRecord approvalRecord){
        List<TaskList> myTaskList = myTaskService.getTaskStepList(approvalRecord);
        return AjaxResult.success("操作成功",myTaskList);
    }
}
